feat: Set the segment source on the scope for NoOpStreamedSpan - #7163
Conversation
Codecov Results 📊✅ 104531 passed | ⏭️ 6677 skipped | Total: 111208 | Pass Rate: 94% | Execution Time: 362m 6s 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ❌ Patch coverage is 73.33%. Project has 2481 uncovered lines. Files with missing lines (2)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 90.14% 90.15% +0.01%
==========================================
Files 193 193 —
Lines 25187 25198 +11
Branches 9178 9190 +12
==========================================
+ Hits 22704 22717 +13
- Misses 2483 2481 -2
- Partials 1430 1433 +3Generated by Codecov Action |
| class NoOpStreamedSpan(StreamedSpan): | ||
| __slots__ = ( | ||
| "_noop_name", | ||
| "_segment_source", |
There was a problem hiding this comment.
Can we directly access the segment attributes to get the source instead of adding a new slot? Right now it's a bit of a hybrid -- I'd either do it exclusively via attributes or exclusively via the new slot, but not both. (Preferring the attributes approach to avoid adding a slot and keeping source handling consistent in StreamedSpan vs NoOpStreamedSpan.)
There was a problem hiding this comment.
I've used _attributes now but only store the sentry.segment.name.source attribute to avoid unnecessary pre-serialization.
NoOpStreamedSpanNoOpStreamedSpan
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8101f7f. Configure here.

Description
Add the
attributesparameter toNoOpStreamedSpan.__init__()and set only thesentry.segment.name.sourceattribute when provided.Set the segment source when a segment
NoOpStreamedSpanis set on the scope.Issues
Reminders
uv run ruff.feat:,fix:,ref:,meta:)